﻿using System;
using System.Configuration;

using TempEmployees.DAL;
using TempEmployees.BLL.EntitiesExtensions;

namespace TempEmployees.BLL.Budgets
{
    public class InitialBudgetCalc
    {
        private static readonly double CoefficientA = double.Parse(ConfigurationManager.AppSettings["CoefficientA"]);
        private static readonly double CoefficientB = double.Parse(ConfigurationManager.AppSettings["CoefficientB"]);

        public static double CalculateInitialBudget(DepartmentsInfo info)
        {
            decimal baseSalary = EBaseSalary.CurrentBaseSalary.Salary;
            int registeredStudents = (int)info.RegisteredStudents;
            double semesterLength = ESemester.GetSemesterLengthInMonth(info.Semester);

            return CoefficientA * (registeredStudents * (double)baseSalary * semesterLength) + CoefficientB;
        }
    }
}
